﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using WinnerCMS.BLL;
using WinnerCMS.Common;
using WinnerCMS.Model;
using WinnerCMS.Model.Enum;

#endregion

namespace WinnerCMS.WebUI.Controllers
{
    public partial class ContentController : ApiController
    {
        [HttpGet, HttpPost]
        public JqueryDatagridDataSource<IList<Core>> List()
        {
            var jdds = new JqueryDatagridDataSource<IList<Core>>();
            var pp = new PagingParam();
            jdds.Rows = new CoreManage().BindList(HttpContext.Current, pp);
            jdds.total = pp.RecordCount;

            return jdds;
        }

        [HttpPost]
        public Result Del([FromBody] string IDs)
        {
            var res = new CoreManage().BatchToDo(IDs, BatchToDo.删除);
            return res;
        }

        [HttpPost]
        public Result Ontop([FromBody] string IDs)
        {
            var res = new CoreManage().BatchToDo(IDs, BatchToDo.置顶或消顶);
            return res;
        }

        [HttpPost]
        public Result Elite([FromBody] string IDs)
        {
            var res = new CoreManage().BatchToDo(IDs, BatchToDo.推荐或消荐);
            return res;
        }

        [HttpPost]
        public Result PassAll([FromBody] string IDs)
        {
            var res = new CoreManage().BatchToDo(IDs, BatchToDo.审核所有);
            return res;
        }

        [HttpPost]
        public Result PassOrUnPass([FromBody] string IDs)
        {
            var res = new CoreManage().BatchToDo(IDs, BatchToDo.审核或弃审);
            return res;
        }
    }
}